Recently there was a request for one of my projects to parse Excel files (with xls/xlsx extensions) in the browser (using JavaScript of course). So I looked online and found these 2 useful libraries:
Js-xls
Js-xlsx
Let's see how they work.CompatibilitySupport for reading
of the document cannot be implemented.Execution conditions:1, Office2007 and above versions of Excel2. Excel enables macrosTool Download:You can create your own new Excel, write VBA code, and code is behind it. You can also use the two I have already written, the following is the link in the Baidu Network disk:"xls2xlsx.xlsm"Link: http://pan.baidu.com/s/1mit3FGc Password:s57a"convert2xlsx.xlsm"Link: http://pan.baidu.com/s/1sluFttb password :pguvFeature Description:First of all, the two tools fe
Office software from the earliest version of the DOS, has been the world's most users of the Office software, the function is also increasingly powerful. At present, some people in the market are using 2007 and 2010, while others remain on 2003. You know that Office 2003 through Office 2007 is a big change, and interface operations vary greatly, even in the suffix format. This makes it impossible for users who use Office 2007 or above and those who use Office 2003 to interoperate, because the fi
Processing of Excel import errors (xls, XLSX)
Recently, the following problems were encountered during the process of creating a small function to import an Excel file to the datagriview:
The link string of The Link Excel is written in this way.
String strconnection = "provider = Microsoft. Jet. oledb.4.0; Data Source =" + strfilename + "; extended properties = E
-yyyymmdd.jar.② when we also want to use XLSX format, also import Poi-ooxml-version-yyyymmdd.jar.③ As for Poi-ooxml-schemas-version-yyyymmdd.jar, this jar is less likely to be used.④ we need to use Poi-scratchpad-version-yyyymmdd.jar when we need to manipulate word, PPT, viso, Outlook, and so on.Friendly tip jar Package: http://poi.apache.org/download.html4. About the difference in performance (reference: http://poi.apache.org/spreadsheet/index.html)I
A few days ago in the project, there are imported Excel files, before there is a written ready-made import method, but the customer's request is able to import. xlsx files, but our method can only import. xls files. On the Internet to find some methods, no error in eclipse, but compile the error is not found files, and then download the latest jar from the POI website (3.13), import projects, again compiled
(),
fileencoding = "", encoding = "Unknown", text, Skipnul = FALSE)
2. R Read CSV file
Using R to read a CSV file is similar to reading a TXT file, using the Read.csv () method, where the use of the parameters is mostly the same.
Read.csv ("/home/slave/test.csv", Header=t, Na.strings=c ("NA"))
When reading the CSV
In the project you are working on, you may need to process multiple Excel output files, including csv, xls, and xlsx files, so I want to convert the last two methods to the csv format and parse them together. so I found the following two classes, both of which are official apache examples. source link:
XLS2CSV: html/api/org/apache/poi/hssf/eventusermodel/examples/XLS2CSVmra.java.html "> http://www.docjar.c
Method One, on-line conversion method
If you want to convert xlsx to XLS, one of the best way is to find a site with this function, now we use most of the most stable site should be considered NetEase online conversion, click here to enter, the specific steps are as follows:
First, open the Web site, enter the conversion page, and then click the "Browse" button, select the
This should be an all-in-one example, and more complex functions can be expanded on this basis. This example is based on the Apache POI Class Library, and the associated jar package is not listed. This kind of library is very general, the Internet is very easy to find.1. Write Excel that does not contain cell merges/** * Excel export to output stream * who is responsible for closing the output stream * @param os output stream * @param excelextname Excel file
Recent projects need to read encrypted Excel, there are two types of XLS and xlsx, for the encryption and decryption Apache official website has a brief descriptionRequired jar Package Poi-3.9,jar Poi-ooxml-3.9.jar Poi-ooxml-schemas-3.9.jar Xmlbeans-2.3.0.jar Dom4j-1.6.1.jarNote that the 3 Jar version number of the POI should correspond, or there will be some problems.On the Code ~ /** * Excel Import */@
:{//determine if the cell is a date format if(dateutil.iscelldateformatted (cell)) {//Convert to date format Yyyy-mm-ddCellvalue =Cell.getdatecellvalue (); }Else{ //DigitalCellvalue =string.valueof (Cell.getnumericcellvalue ()); } Break; } Casecell.cell_type_string:{Cellvalue=Cell.getrichstringcellvalue (). getString (); Break; } default: Cellvalue= ""; } }Else{Cellvalue= ""; } returnCellvalue; }}Iv. Results
Sub Test ()Dim WB as Workbook, MPath as String, F as StringApplication.DisplayAlerts = Falseapplication.screenupdating = FalseApplication.calculation = xlcalculationmanualIf workbooks.count > 1 then MsgBox "Close the other workbooks and try again!" ": Exit SubMsgBox "Select the folder where the. xlsx file is located! "With Application.filedialog (msoFileDialogFolderPicker). Show. AllowMultiSelect = FalseIf.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.